home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Graphics Programming (2nd Edition) / Visual Basic Graphics Programming 2nd Edition.iso / Src / Ch7 / Stretch.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1999-04-30  |  2.5 KB  |  88 lines

  1. VERSION 5.00
  2. Begin VB.Form frmStretch 
  3.    Caption         =   "Stretch"
  4.    ClientHeight    =   4950
  5.    ClientLeft      =   60
  6.    ClientTop       =   345
  7.    ClientWidth     =   4935
  8.    LinkTopic       =   "Form1"
  9.    ScaleHeight     =   4950
  10.    ScaleWidth      =   4935
  11.    StartUpPosition =   3  'Windows Default
  12.    Begin VB.PictureBox picResult 
  13.       AutoRedraw      =   -1  'True
  14.       Height          =   2310
  15.       Index           =   2
  16.       Left            =   2520
  17.       ScaleHeight     =   2250
  18.       ScaleWidth      =   2250
  19.       TabIndex        =   3
  20.       Top             =   2520
  21.       Width           =   2310
  22.    End
  23.    Begin VB.PictureBox picResult 
  24.       AutoRedraw      =   -1  'True
  25.       Height          =   2310
  26.       Index           =   1
  27.       Left            =   120
  28.       ScaleHeight     =   2250
  29.       ScaleWidth      =   2250
  30.       TabIndex        =   2
  31.       Top             =   2520
  32.       Width           =   2310
  33.    End
  34.    Begin VB.PictureBox picResult 
  35.       AutoRedraw      =   -1  'True
  36.       Height          =   2310
  37.       Index           =   0
  38.       Left            =   2520
  39.       ScaleHeight     =   2250
  40.       ScaleWidth      =   2250
  41.       TabIndex        =   1
  42.       Top             =   120
  43.       Width           =   2310
  44.    End
  45.    Begin VB.PictureBox picOriginal 
  46.       AutoRedraw      =   -1  'True
  47.       AutoSize        =   -1  'True
  48.       Height          =   2310
  49.       Left            =   120
  50.       Picture         =   "Stretch.frx":0000
  51.       ScaleHeight     =   2250
  52.       ScaleWidth      =   2250
  53.       TabIndex        =   0
  54.       Top             =   120
  55.       Width           =   2310
  56.    End
  57. Attribute VB_Name = "frmStretch"
  58. Attribute VB_GlobalNameSpace = False
  59. Attribute VB_Creatable = False
  60. Attribute VB_PredeclaredId = True
  61. Attribute VB_Exposed = False
  62. Option Explicit
  63. ' Make the enlarged images.
  64. Private Sub Form_Load()
  65. Dim i As Integer
  66. Dim scale_factor As Single
  67. Dim X As Single
  68. Dim Y As Single
  69. Dim orig_wid As Single
  70. Dim orig_hgt As Single
  71. Dim wid As Single
  72. Dim hgt As Single
  73.     orig_wid = picOriginal.ScaleWidth
  74.     orig_hgt = picOriginal.ScaleHeight
  75.     scale_factor = 4
  76.     For i = 0 To 2
  77.         wid = orig_wid / scale_factor
  78.         hgt = orig_hgt / scale_factor
  79.         X = (orig_wid - wid) / 2
  80.         Y = (orig_hgt - hgt) / 2
  81.         picResult(i).PaintPicture _
  82.             picOriginal.Picture, _
  83.             0, 0, orig_wid, orig_hgt, _
  84.             X, Y, wid, hgt
  85.         scale_factor = scale_factor * 2
  86.     Next i
  87. End Sub
  88.